using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Viettel.VOFFICE.DAO.Models.Mapping
{
    public class OfficePartnerMap : EntityTypeConfiguration<OfficePartner>
    {
        public OfficePartnerMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.Address)
                .HasMaxLength(500);

            this.Property(t => t.Email)
                .HasMaxLength(200);

            this.Property(t => t.Phone)
                .HasMaxLength(20);

            this.Property(t => t.Representer)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("OfficePartners");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.Phone).HasColumnName("Phone");
            this.Property(t => t.Representer).HasColumnName("Representer");
            this.Property(t => t.CreatedAt).HasColumnName("CreatedAt");
            this.Property(t => t.UpdatedAt).HasColumnName("UpdatedAt");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
        }
    }
}
